// Copyright (c) 2007 Alistair Jones
// This program is made available under the terms of the MIT License.
package org.hypirinha.html.codegen;

import static org.hypirinha.html.codegen.CodegenUtil.commaSeparate;

import java.io.PrintStream;
import java.util.List;
import java.util.ArrayList;

public class InnerInterface implements Member {
    private final String interfaceName;
    protected List<String> baseInterfaces = new ArrayList<String>();
    

    public InnerInterface(String interfaceName) {
        this.interfaceName = interfaceName;
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public void printTo(PrintStream printStream) {
        printStream.println();
        printStream.println("    " + "interface " + interfaceName + formatBaseInterfaces() + " {}");
    }

    private String formatBaseInterfaces() {
        if (baseInterfaces.isEmpty()) {
            return "";
        }
        return " extends " + commaSeparate(baseInterfaces);
    }

    public void addBaseInterface(String interfaceName) {
        baseInterfaces.add(interfaceName);
    }
}
